package com.apposcopy.ella.runtime;

import java.net.MalformedURLException;
import java.net.URL;

public class HttpRequestHandler extends Recorder {
	
	@Override
	public URL changeRequestURL(URL url) throws MalformedURLException{
		// TODO support other protocol
		if(!url.getProtocol().equals("http")){
			return url;
		}
		// TODO support user info 
		// String userInfo = url.getUserInfo() == null ? "" : url.getUserInfo();
		String ref = url.getRef() == null ? "" : url.getRef();
		return new URL(url.getProtocol(), "localhost", Ella.mockServerPort, url.getFile() + "#" + ref);
	}
}
